(function () {
    let init = echarts.init(document.querySelector('#Sort'));
    let option = {
        grid: {
            top: '10%',
            bottom: '10%',
            left: '20%',
            right: '20%'
        },
        tooltip: {
            trigger: "axis",
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: "shadow" // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        xAxis: [{
            type: 'value',
            axisLabel: {show: false},
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            }
        }],
        yAxis: {
            type: 'category',
            data: [""],
            axisLabel: {
                interval: 0,
                textStyle: {
                    color: '#ffffff'
                },
                fontSize: 12
            },
            axisTick: {
                show: false
            },
            axisLine: {
                show: false
            }
        },
        series: {
            data: [],
            type: 'bar',
            showBackground: true,
            label: {
                show: true,
                position: 'right',
                color: '#FFFFFF',
                textStyle: {
                    fontSize: 12
                }
            },
            itemStyle: {
                color: new echarts.graphic.LinearGradient(
                    1, 0, 0, 0,
                    [
                        {offset: 0, color: '#83bff6'},
                        {offset: 0.5, color: '#188df0'},
                        {offset: 1, color: '#188df0'}
                    ]
                ),
                barBorderRadius: [0, 5, 5, 0]
            },
            emphasis: {
                itemStyle: {
                    color: new echarts.graphic.LinearGradient(
                        1, 0, 0, 0,
                        [
                            {offset: 0, color: '#2378f7'},
                            {offset: 0.7, color: '#2378f7'},
                            {offset: 1, color: '#83bff6'}
                        ]
                    )
                }
            }
        }
    }
    let fontChange = function (baseSize) {
        option.yAxis.axisLabel.fontSize = Number((0.747 * baseSize).toFixed(0));
        option.series.label.textStyle.fontSize = Number((0.747 * baseSize).toFixed(0));
        return option;
    }
    resizeCallBack.push({chart: init, fontChange: fontChange})
    let updateFun = function (ydata, xdata) {
        option.series.data = xdata;
        option.yAxis.data = ydata;
        init.setOption(option);
    }
    if (charts1) {
        charts1['11'] = updateFun;
    }


})()